package com.yanqu.road.server.cmd.newmonopolymkt.res;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.common.CommonProto;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.command.Command;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.newmonopolymkt.NewMonopolyMarketModule;
import com.yanqu.road.server.manger.player.GamePlayerMgr;
import com.yanqu.road.server.manger.systemgroup.newmonopolymarket.NewMonopolyMarketMgr;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.server.protocol.GameProtocol;
import io.netty.channel.ChannelHandlerContext;

@Cmd(code = GameProtocol.S_NEW_MONOPOLY_MARKET_NORMAL_SETTLEMENT_NOTIFY_FROM_CROSS, desc = "资源争夺战 通知玩家据点被正常结算了")
public class NewMonopolyMarketResGrabNormalSettlementNotifyFromCrossCmd implements Command {
    @Override
    public void execute(ChannelHandlerContext ctx, YanQuMessage packet) throws Exception {
        GamePlayer player = GamePlayerMgr.getOnlinePlayer(packet.getPlayerId());

        if(player != null){
            NewMonopolyMarketModule marketModule = player.getModule(NewMonopolyMarketModule.class);
            if(marketModule.getInSystemId() >= 0){
                // 去跨服领取奖励
                NewMonopolyMarketMgr.sendAppointActivityPacket(player.getUserId(), CrossProtocol.C_CROSS_NEW_MONOPOLY_MARKET_RES_GRAB_RECEIVE_REWARD, CommonProto.NullValueMsg.newBuilder());
            }
        }
    }
}

